<template lang="pug">
div()
    div(class="weui-mask",v-if="visible")
    div(:class="{'weui-actionsheet':true, 'weui-actionsheet_toggle': visible}")
        div(class="weui-actionsheet__menu")
            div(class="weui-actionsheet__cell" v-for="item in items" :key="item.id" @click="itemClick(item)") {{item.name}}
        div(class="weui-actionsheet__action")
            div(class="weui-actionsheet__cell" @click="doCancel") 取消
</template>
<script>
export default {
  props: {
    items: {
      type: Array,
      default() {
        return [];
      }
    },
    visible: { type: Boolean, default: false }
  },
  methods: {
    doCancel() {
      this.$emit("cancel");
    },
    itemClick(item) {
      this.$emit("item-click", item);
    }
  }
};
</script>

